package Tathy;

import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

import GameEngine.GameEngine;
import GameEngine.GameObject2D;

public class Inventario extends GameObject2D {
	BufferedImage inv;
	int posX = 775;
	boolean inve = false;
	
	public Inventario() {
		super("");
		try{
			inv = ImageIO.read(getClass().getResource("inventario.png"));
			
		}catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void paint(Graphics g) {
		g.drawImage(inv, posX, 0, null);
		if(inve== true){
			posX-=2;
			if(posX<575){
				posX=575;
			}
		}
		if(inve== false){
			posX+=2;
			if(posX>775){
				posX=775;
			}
		}
	}

	@Override
	public void updateKeyEvent(KeyEvent keyevent) {
		if(GameEngine.iPressed){
			if(inve==false && posX==775){
				inve=true;
			}
			if(inve==true && posX==575){
				inve=false;
			}
			
		}
		
	}

	@Override
	public void updateMouseEvent(MouseEvent mouseevent) {
		// TODO Auto-generated method stub
		
	}

}
